package com.example.demo.web.im.endpoint;

import com.example.demo.web.im.service.ImService;
import java.io.IOException;
import org.noear.solon.annotation.Inject;
import org.noear.solon.net.annotation.ServerEndpoint;
import org.noear.solon.net.websocket.WebSocket;
import org.noear.solon.net.websocket.listener.SimpleWebSocketListener;

/**
 * @author airhead
 */
@ServerEndpoint("/im.ws")
public class ImWebsocket extends SimpleWebSocketListener {
  @Inject private ImService service;

  @Override
  public void onOpen(WebSocket socket) {
    service.onOpen(socket);
  }

  @Override
  public void onMessage(WebSocket socket, String text) throws IOException {
    service.onMessage(socket, text);
  }
}
